<template>
	<view class="tarbar flexbox flexbox-middle">
		<view  @click="goto('/pages/index/index')" class="flexchild" :class="{'active': active == '1'}">
			<image v-if="active == '1'" class="bar-icon" src="/static/images/bar_icon1_active.png"></image>
			<image v-else class="bar-icon" src="/static/images/bar_icon1.png"></image>
			<view>首页</view>
		</view>
		
		<!-- <view @click="scancode" class="flexchild" :class="{'active': active == '2'}">
			<image class="bar-icon" src="/static/images/bar_icon2.png"></image>
			<view>扫码</view>
		</view> -->
		
		<view @click="goto('/pages/my/index')" class="flexchild" :class="{'active': active == '3'}">
			<image v-if="active == '3'" class="bar-icon" src="/static/images/bar_icon3_active.png"></image>
			<image v-else class="bar-icon" src="/static/images/bar_icon3.png" ></image>
			<view>我的</view>
		</view>
	</view>
</template>
<script>
	import { scancode } from '@/static/js/utils.js'
 	export default {
		name : "tarBar",
		props: {
			active : {
				type: String,
				default: '1',
				randomNumber: ''
			}
		},
		methods: {
			goto(url){		
				uni.switchTab({
				    url: url
				});
			},
			stopEvent(){
				
			},
			moveHandle(){
				
			},
			scancode() {
				scancode(this)
			},
			authCode() {
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tarbar {
		position: fixed;
		width: 100%;
		height: 106rpx;
		background-color: #FFFFFF;
		border-top: 1rpx solid #d6d6d6;
		left: 0;
		bottom: 0;
		z-index: 99;
		font-size: 20rpx;
		text-align: center;
		line-height: 20rpx;
		.bar-icon {
			width: 66rpx;
			height: 66rpx;
		}
	}
	
</style>
